package com.neuedu.weishi.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Service;
import org.springframework.stereotype.Repository;

import com.neuedu.weishi.entity.VideoFavorite;
import com.neuedu.weishi.mapper.VideoFavoriteMapper;
import com.neuedu.weishi.service.IVideoFavoriteService;

import java.util.List;

@Service("videoFavoriteService")
public class VideoFavoriteServiceImpl implements IVideoFavoriteService {

    @Autowired
    @Qualifier("videoFavoriteMapper")
    private VideoFavoriteMapper videoFavoriteMapper;

    @Override
    public List<VideoFavorite> selectList(VideoFavorite videoFavorite){
        QueryWrapper<VideoFavorite> queryWrapper = new QueryWrapper<>();
        return videoFavoriteMapper.selectList(queryWrapper);
    }

    @Override
    public IPage<VideoFavorite> selectPage(IPage<VideoFavorite> page){
        QueryWrapper<VideoFavorite> queryWrapper = new QueryWrapper<>();
        return videoFavoriteMapper.selectPage(page, queryWrapper);
    }

    @Override
    public VideoFavorite selectById(Integer favoriteId) {
        return videoFavoriteMapper.selectById(favoriteId);
    }

    @Override
    public int deleteById(Integer favoriteId) {
        return videoFavoriteMapper.deleteById(favoriteId);
    }

    @Override
    public int delete(VideoFavorite videoFavorite){
        QueryWrapper<VideoFavorite> queryWrapper = new QueryWrapper<>();
        return videoFavoriteMapper.delete(queryWrapper);
    }

    @Override
    public int insert(VideoFavorite videoFavorite) {
        return videoFavoriteMapper.insert( videoFavorite);
    }

    @Override
    public int updateById(VideoFavorite videoFavorite) {
        return videoFavoriteMapper.updateById(videoFavorite);
    }

    @Override
    public int update(VideoFavorite videoFavorite) {
        UpdateWrapper<VideoFavorite> updateWrapper = new UpdateWrapper<>();
        return videoFavoriteMapper.update(videoFavorite,updateWrapper);
    }
}